/*
 * Copyright (c) 2021 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef INTERFACES_KITS_NAPI_COMMON_LOG_H
#define INTERFACES_KITS_NAPI_COMMON_LOG_H

#include <cstdio>
#include <string>
#include <vector>

#include "hilog/log.h"

#if __HAVE_DEBUG__

#ifdef HILOGD
#undef HILOGD
#endif

#ifdef HILOGF
#undef HILOGF
#endif

#ifdef HILOGE
#undef HILOGE
#endif

#ifdef HILOGW
#undef HILOGW
#endif

#ifdef HILOGI
#undef HILOGI
#endif

#define HILOGD(fmt, ...) OH_LOG_DEBUG(LOG_APP, "[%{public}s|%{public}d]: " fmt, __func__, __LINE__, ##__VA_ARGS__)
#define HILOGI(fmt, ...) OH_LOG_INFO(LOG_APP, "[%{public}s|%{public}d]: " fmt, __func__, __LINE__, ##__VA_ARGS__)
#define HILOGW(fmt, ...) OH_LOG_WARN(LOG_APP, "[%{public}s|%{public}d]: " fmt, __func__, __LINE__, ##__VA_ARGS__)
#define HILOGE(fmt, ...) OH_LOG_ERROR(LOG_APP, "[%{public}s|%{public}d]: " fmt, __func__, __LINE__, ##__VA_ARGS__)
#define HILOGF(fmt, ...) OH_LOG_FATAL(LOG_APP, "[%{public}s|%{public}d]: " fmt, __func__, __LINE__, ##__VA_ARGS__)

#else
#define HILOGD(fmt, ...)	do{}while(0)
#define HILOGI(fmt, ...)	do{}while(0)
#define HILOGW(fmt, ...)	do{}while(0)
#define HILOGE(fmt, ...)	do{}while(0)
#define HILOGF(fmt, ...)	do{}while(0)
#endif
#endif